package cn.tonyandmoney.baidu

import android.content.Context
import cn.tonyandmoney.baidu.asr.config.IRecogParams
import cn.tonyandmoney.baidu.event.SpeechEvent
import cn.tonyandmoney.baidu.tts.Speaker
import io.reactivex.functions.Consumer

interface ISpeech {

    var isRecognizing: Boolean

    fun start()
    fun stop()

    fun getSpeaker(): Speaker

    fun speak(content: String, id: String? = null)
    fun destroy()

    companion object {

        var INSTANCE: ISpeech? = null

        fun create(context: Context,
                   consumer: Consumer<SpeechEvent>,
                   params: IRecogParams): ISpeech {
            INSTANCE = SpeechImpl(context, consumer, params)
            return INSTANCE!!
        }
    }

}